<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>快招</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="/public/js/mui/css/mui.min.css">
		<link rel="stylesheet" href="/public/weixin/css/css/index.css">
		<link rel="stylesheet" href="/public/weixin/css/iconfont/iconfont.css" />
		<style>
			.mui-row.mui-fullscreen>[class*="mui-col-"] {
				height: 100%;
			}
			.mui-col-xs-6,
			.mui-control-content {
				overflow-y: auto;
				height: 100%;
			}
			
			.mui-segmented-control .mui-control-item {
				line-height: 50px;
				width: 100%;
			}
			.mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
				background-color: #fff;
			}
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: 40px;
				height: 40px;
				border-radius: 100%;
				z-index: 1;
			}
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			.mui-pull-top-wrapper {
				width: 42px;
				height: 42px;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			
			.mui-pull-top-tips .mui-pull-loading {
				/*-webkit-backface-visibility: hidden;
                -webkit-transition-duration: 400ms;
                transition-duration: 400ms;*/
				margin: 0;
			}
			
			.mui-pull-top-wrapper .mui-icon,
			.mui-pull-top-wrapper .mui-spinner {
				margin-top: 7px;
			}
			
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height: 40px;
				color: #777;
			}
			
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: 40px;
				height: 40px;
				margin: 0 auto;
			}
			
			.mui-pull-top-canvas canvas {
				width: 40px;
			}
			
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
		</style>
	</head>

	<body>
		<input type="hidden" value="<?php echo ($now_page_size); ?>" name="now_page_size" id="now_page_size">
		<input type="hidden" value="<?php echo ($city_id); ?>" name="city_id" id="city_id">
		<input type="hidden" value="<?php echo ($has_more); ?>" name="has_more" id="has_more">
		<div id="offCanvasWrapper" class="mui-off-canvas-wrap mui-draggable">
			<!--侧滑菜单部分-->
			<aside id="offCanvasSide" class="mui-off-canvas-left">
				<div id="offCanvasSideScroll" class="mui-scroll-wrapper">
					<div class="left_top">
						<div class="own_lt_list" id="my_staff">
							<span class="own_lt_icon iconfont">&#xe792;</span>
							<span class="own_lt_text">我的工友</span>
							<span class="own_lt_number mui-badge mui-badge-danger" id="user_invite_count"><?php echo ($user["invite_count"]); ?></span>
						</div>
						<div class="own_lt_list" id="my_money">
							<span class="own_lt_icon iconfont">&#xe7de;</span>
							<span class="own_lt_text">我的钱包</span>
							<span class="own_lt_number mui-badge mui-badge-danger" id="user_total_money"><?php echo ($user["total_money"]); ?></span>
						</div>
						<div class="own_lt_list" id="user_detail">
							<span class="own_lt_icon iconfont">&#xe7b3;</span>
							<span class="own_lt_text">个人信息</span>
						</div>
						<div class="own_lt_list" id="pick_point">
							<span class="own_lt_icon iconfont">&#xe781;</span>
							<span class="own_lt_text">接车点</span>
						</div>
					</div>
					<div class="left_bottom" id="user_detail_desc">

						<div class="left_headimg" id="head_img_url">
							<img src="<?php echo ($user["headimgurl"]); ?>">
						</div>

                        <div class="left_nametype">
                            <div class="left_name">
                                <?php echo ($user["nickname"]); ?>
                            </div>
                            <div class="left_type">
                                <?php if(empty($user['id'])): ?>未加盟
                                    <?php else: ?>
                                    <?php echo C('USER_SH_STATE')[$user['state']]['dict_text']; endif; ?>
                            </div>
                        </div>

					</div>
				</div>
			</aside>
			<!--主界面部分-->
			<div class="mui-inner-wrap">
				<header class="mui-bar mui-bar-nav">
					<a href="#offCanvasSide">
						<img class="personal_headimg" src="<?php echo ($user["headimgurl"]); ?>" alt="用户头像" />
					</a>
					<h1 class="mui-title" id="menu-btn">
						<span id="city_name_show">
						<?php if(empty($city_name)): ?>全国
							<?php else: ?>
							<?php echo ($city_name); endif; ?>
						</span>
						<span class="iconfont">&#xe78a;</span>
					</h1>
				</header>
				<div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper" id="coms_scroll_wrapper">
					<div class="mui-scroll" id="coms_scroll">
						<ul class="mui-table-view" id="com_list">
							<?php if(is_array($list)): foreach($list as $key=>$item): ?><li class="mui-table-view-cell" style="transform-style: preserve-3d; <?php if($item["is_top"] == 1 ): ?>background-color:#F4F7F7;<?php endif; ?>" id="<?php echo ($item["id"]); ?>">
        <div class="mui-slider-right mui-disabled">
            <a class="mui-btn mui-btn-ownprice mui-icon" style="font-size: 16px;"
               id="<?php echo ($item["id"]); ?>">申请报名</a>
        </div>
        <div class="mui-slider-handle">
            <div class="mui-media">
                <div class="mui-media-body" style="<?php if($item["is_top"] == 1 ): ?>background-color:#F4F7F7;<?php endif; if($item["is_nojob"] == 1 ): ?>background-image: url(public/images/noJob.png);background-repeat: no-repeat;background-position:center right;<?php endif; ?>">
                    <div class="own_comname">
                       <?php echo ($item["com_name"]); ?>
                    </div>
                    <div class="own_jobtype_mo iconfont" >
                        <div>
                            <span style="color: #47B7F9;">
                                 &#xe7ae;&nbsp;<?php echo ($item["job_type"]); ?>
                            </span>
                        </div>
                        <div></div>
                        <div style="text-align: right;">
                           <!--  <span> -->
                               <span style="border-width:1px; border-style:solid; border-color:#47B7F9; padding: 5px; color:#47B7F9; ">合伙人奖金</span> 
                                <!--&#xe7de;&nbsp;<?php echo C('COM_PJXZ')[$item['pay']]['dict_text'];?>元&lt;!&ndash;薪资范畴&ndash;&gt;-->
                            <!-- </span> -->
                        </div>
                    </div>
                    <div class="own_pa">
                        <div class="own_workplace iconfont">
                            &#xe7c0;&nbsp;
                            <?php echo F('cache_city')[$item['province']]['name'];?>·<?php echo F('cache_city')[$item['city']]['name'];?>·<?php echo F('cache_city')[$item['district']]['name'];?>
                            <!--<?php echo F('cache_city')[$item['district']]['name'];?>--><!--地点-->
                        </div>
                        
                        <div class="own_workaward iconfont">
                             &#xe77a; <span style="color: #ccc;">入职满<?php echo ($item["onjob_day"]); ?>天</span>&nbsp;<?php echo ($item["com_give"]); ?>元/人
                            <!--入职奖-->
                        </div>
                        <!-- <div class="own_workaward iconfont"> 入职满2天</div> -->
                    </div>
                </div>
            </div>
        </div>
    </li><?php endforeach; endif; ?>
						</ul>
					</div>
				</div>
				<div class="mui-off-canvas-backdrop"></div>
			</div>
			</div>

			<div id="lay_content" style="display: none;">
				<header class="mui-bar mui-bar-nav">
					<a class="mui-icon mui-icon-left-nav mui-pull-left" id="city_close"></a>
					<h1 class="mui-title">行政区选择</h1>
				</header>
				<div class="mui-content mui-row mui-fullscreen" id="city_list">
					<?php if(is_array($cache_city_select)): foreach($cache_city_select as $p=>$po): if($p == 0 ): ?><!--左边栏-->
							<div class="mui-col-xs-6" style="width: 35%;">
								<div id="segmentedControls" class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-vertical"><?php endif; ?>
						<?php if($p == 0 ): ?><a class="mui-control-item mui-active" href="#content<?php echo ($po["id"]); ?>"><?php echo ($po["name"]); ?></a>
							<?php else: ?>
							<a class="mui-control-item" href="#content<?php echo ($po["id"]); ?>"><?php echo ($po["name"]); ?></a><?php endif; ?>
						<?php if(count($cache_city_select) == ($p+1) ): ?></div>
							</div><?php endif; endforeach; endif; ?>
					<?php if(is_array($cache_city_select)): foreach($cache_city_select as $p=>$po): if($p == 0 ): ?><!--右边栏-->
							<div id="segmentedControlContents" class="mui-col-xs-6"><?php endif; ?>
						<?php if($p == 0 ): ?><div id="content<?php echo ($po["id"]); ?>" class="mui-control-content mui-active">
								<ul class="mui-table-view">
									<?php if(is_array($po["childer"])): foreach($po["childer"] as $c=>$co): ?><li class="mui-table-view-cell" name="<?php echo ($co["name"]); ?>" id="<?php echo ($co["id"]); ?>"><?php echo ($co["name"]); ?></li><?php endforeach; endif; ?>
								</ul>
							</div>
							<?php else: ?>
							<div id="content<?php echo ($po["id"]); ?>" class="mui-control-content">
								<ul class="mui-table-view">
									<?php if(is_array($po["childer"])): foreach($po["childer"] as $c=>$co): ?><li class="mui-table-view-cell" name="<?php echo ($co["name"]); ?>" id="<?php echo ($co["id"]); ?>"><?php echo ($co["name"]); ?></li><?php endforeach; endif; ?>
								</ul>
							</div><?php endif; ?>
						<?php if(count($cache_city_select) == ($p+1)): ?></div><?php endif; endforeach; endif; ?>
				</div>

			</div>

			<script src="/public/js/mui/js/mui.js"></script>
			<script src="/public/js/mui/js/mui.pullToRefresh.js"></script>
			<script src="/public/js/mui/js/mui.pullToRefresh.material.js"></script>
			<script src="/public/js/jquery-3.1.1.min.js"></script>
			<script>
				$(function(){
					var $user_invite_count = $('#user_invite_count');
					var $user_total_money = $('#user_total_money');
                    var url = "<?php echo U('Coms/get_user_info_num');?>"+"&v="+Math.random();
                    mui.ajax(url, {
                        dataType: 'json',
                        type: 'post',
                        timeout: 0,
                        headers: {
                            'Content-Type': 'application/json'
                        },
                        success: function(data) {
                            $user_invite_count.text(data['invite_count']);
                            $user_total_money.text(data['total_money']);
                        },
                        error: function(xhr, type, errorThrown) {
                            console.log(xhr);
                            console.log(type);
                            console.log(errorThrown);
                        }
                    });
                });
				var now_page_size = document.getElementById("now_page_size").value; //当前页显示数量
				var has_more = parseInt(document.getElementById("has_more").value); //是否有跟多数据
				var $com_list = $('#com_list'); //企业列表
				var $lay_content = $("#lay_content"); //行政区显示层
				var $offCanvasWrapper = $('#offCanvasWrapper'); //页面主体显示层
				var cityshow = true; //行政区层显示控制
				var city_id =  document.getElementById("city_id").value; //当前行政区选择ID
				var $menu_btn = $('#menu-btn');
				var deceleration = mui.os.ios ? 0.003 : 0.0009;
				var $city_name_show = $('#city_name_show');
				mui('#coms_scroll_wrapper').scroll({
					bounce: false,
					indicators: true, //是否显示滚动条
					deceleration: deceleration
				});
				mui("#coms_scroll").pullToRefresh({
					up: {
						callback: function() {
							var self = this;
							if(!has_more) {
								self.endPullUpToRefresh(true);
								return;
							}
							pullupRefresh(self);
						}
					}
				});

                if(!has_more) {
                    mui('#coms_scroll').pullToRefresh().endPullUpToRefresh(true);
                }

				//上拉加载回调
				function pullupRefresh(self) {

					var url = "<?php echo U('Coms/get_com_list');?>" + '&now_page_size=' + now_page_size + "&city_id=" + city_id;
					mui.ajax(url, {
						dataType: 'json',
						type: 'post',
						timeout: 0,
						headers: {
							'Content-Type': 'application/json'
						},
						success: function(data) {
							var content = data.content;
							now_page_size = data.now_page_size;
							$com_list.append(content);
							self.endPullUpToRefresh(!data.has_more);
						},
						error: function(xhr, type, errorThrown) {
							console.log(xhr);
							console.log(type);
							console.log(errorThrown);
						}
					});

				}

				//侧滑菜单
				var offCanvasWrapper = mui('#offCanvasWrapper');
				var offCanvasSide = document.getElementById("offCanvasSide");
				mui('#offCanvasSideScroll').scroll();
				mui('#offCanvasContentScroll').scroll();

				//企业详情
				mui("#com_list").on('tap', '.mui-table-view-cell', function() {
					window.location.href = "<?php echo U('Coms/detail');?>" + '&id=' + this.getAttribute("id");
				});

				/**
				 * 报名申请
				 * */
				mui("#com_list").on('tap', '.mui-btn-ownprice', function() {
					window.location.href = "<?php echo U('Coms/apply_job');?>" + '&id=' + this.getAttribute("id");
				});

				/**
				 *行政区显示 
				 */
				document.getElementById("menu-btn").addEventListener('tap', function() {
					change_city_show();
				});
				document.getElementById("city_close").addEventListener('tap', function() {
					change_city_show();
				});

				mui("#city_list").on('tap', '.mui-table-view-cell', function() {
                    $city_name_show.text(this.getAttribute("name"));
					city_id = this.getAttribute("id"); //设置当前城市选择ID
					has_more = true; //设置为还有跟多数据
					now_page_size = 0; //当前页面数量重置为0
					$com_list.html(""); //清空原来的数据
					mui('#coms_scroll').pullToRefresh().refresh(true);
					mui('#coms_scroll').pullToRefresh().pullUpLoading();
					change_city_show();
				});

				/**控行政区显示或者隐藏**/
				function change_city_show() {
					if(cityshow) {
						$offCanvasWrapper.hide();
						$lay_content.show();

					} else {
						$offCanvasWrapper.show();
						$lay_content.hide();
					}
					cityshow = !cityshow;
				}

				mui("#my_staff").on('tap', 'span', function() {
					window.location.href = "<?php echo U('User/my_staff');?>";
				});
				mui("#my_money").on('tap', 'span', function() {
					window.location.href = "<?php echo U('User/my_money');?>";
				});
				mui("#user_detail").on('tap', 'span', function() {
					window.location.href = "<?php echo U('User/user_detail');?>";
				});

                mui("#user_detail_desc").on('tap', '#head_img_url', function() {
                    window.location.href = "<?php echo U('User/user_detail');?>";
                });

				mui("#pick_point").on('tap', 'span', function() {
					window.location.href = "<?php echo U('User/pick_point');?>";
				});
			</script>
	</body>

</html>